package com.example.ResumeWorkPlatform.dao;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * @ClassName:  workResumptionEntity
 * @Description: 复工记录表
 * @Author chengwenixng
 * @DateTime 2020-3-31 19:59:45
 */
// WorkResumptionEntity实体继承自Serializable创建的对象可以被JVM（java虚拟机）序列化（序列化就是有一个自己独特的标识）

@Entity
@Table(name = "work_resumption_entity")
public class WorkResumptionEntity implements Serializable{
	//序列化
		private static final long serialVersionUID = 1L;
		/**
		 * 数据库自增长ID
		 */
		@Id
		@GeneratedValue(strategy = GenerationType.IDENTITY)
		private Long id;
		
		
		/**
		 * 删除标识符
		 */
		private boolean delFlag = true;
		/**
		 * 考勤时间
		 */
		private Date WorkResumptionTime = new Date();
		/**
		 * 工业园区-复工（一对一）
		 */
		@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
		private GerdenEntity gerdenEntity;
		/**
		 * 复工-用户 多对一
		 */
		@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY)
		private BasicUserEntity basicUserEntity;
		public Long getId() {
			return id;
		}
		public void setId(Long id) {
			this.id = id;
		}
		public boolean isDelFlag() {
			return delFlag;
		}
		public void setDelFlag(boolean delFlag) {
			this.delFlag = delFlag;
		}
		public Date getWorkResumptionTime() {
			return WorkResumptionTime;
		}
		public void setWorkResumptionTime(Date workResumptionTime) {
			WorkResumptionTime = workResumptionTime;
		}
		public GerdenEntity getGerdenEntity() {
			return gerdenEntity;
		}
		public void setGerdenEntity(GerdenEntity gerdenEntity) {
			this.gerdenEntity = gerdenEntity;
		}
		public BasicUserEntity getBasicUserEntity() {
			return basicUserEntity;
		}
		public void setBasicUserEntity(BasicUserEntity basicUserEntity) {
			this.basicUserEntity = basicUserEntity;
		}
		@Override
		public int hashCode() {
			final int prime = 31;
			int result = 1;
			result = prime * result + ((WorkResumptionTime == null) ? 0 : WorkResumptionTime.hashCode());
			result = prime * result + ((basicUserEntity == null) ? 0 : basicUserEntity.hashCode());
			result = prime * result + (delFlag ? 1231 : 1237);
			result = prime * result + ((gerdenEntity == null) ? 0 : gerdenEntity.hashCode());
			result = prime * result + ((id == null) ? 0 : id.hashCode());
			return result;
		}
		@Override
		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (getClass() != obj.getClass())
				return false;
			WorkResumptionEntity other = (WorkResumptionEntity) obj;
			if (WorkResumptionTime == null) {
				if (other.WorkResumptionTime != null)
					return false;
			} else if (!WorkResumptionTime.equals(other.WorkResumptionTime))
				return false;
			if (basicUserEntity == null) {
				if (other.basicUserEntity != null)
					return false;
			} else if (!basicUserEntity.equals(other.basicUserEntity))
				return false;
			if (delFlag != other.delFlag)
				return false;
			if (gerdenEntity == null) {
				if (other.gerdenEntity != null)
					return false;
			} else if (!gerdenEntity.equals(other.gerdenEntity))
				return false;
			if (id == null) {
				if (other.id != null)
					return false;
			} else if (!id.equals(other.id))
				return false;
			return true;
		}
		
		
		
}
